﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="OpenManageRoleProgramMapping.ascx.vb"
    Inherits="WebForm_ManageRole_OpenManageRoleProgramMapping" %>
<div style="background-color: #351D26">
    <asp:Panel ID="panel1" runat="server" BorderWidth="1" Style="background-color: #351D26;
        cursor: move;" Width="600" Height="500">
        <br />
        <div align="center">
            <asp:Label ID="lblTitle" runat="server" Text="<%$ Resources:Title %>" SkinID="title"></asp:Label>
        </div>
        <table width="100%">
            <tr>
                <td>
                    <asp:Label ID="lblProgramGroup" runat="server" Text="<%$ Resources:ProgramGroup%>"></asp:Label>
                    <TServerControl:TDropDownList ID="ddlProgramGroup" runat="server" AutoPostBack="True"
                        DataSourceID="SqlDataSource_ProgramGroup" DataTextField="ProgramName" DataValueField="ProgramID"
                        OnSelectedIndexChanged="ddlProgramGroup_SelectedIndexChanged">
                    </TServerControl:TDropDownList>
                    <asp:SqlDataSource ID="SqlDataSource_ProgramGroup" runat="server" ConnectionString="<%$ ConnectionStrings:connStr %>"
                        SelectCommand="SELECT 0 as ProgramID,'All' as ProgramName,0 as Sequence
                                    UNION
                                    SELECT ProgramID,ProgramName,Sequence
                                    FROM Program
                                    WHERE PArent=0 AND Active='Y' AND Editable='Y'
                                    ORDER BY ProgramID"></asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td>
                    <TServerControl:TGridView ID="TGridView1" runat="server" AllowHoverEffect="True"
                        AllowHoverSelect="True" ShowFooterWhenEmpty="False" ShowHeaderWhenEmpty="False"
                        TotalRowCount="0" AutoGenerateColumns="False" DataKeyNames="ProgramID" SkinID="pager"
                        OnPageIndexChanged="TGridView1_PageIndexChanged" OnRowDataBound="TGridView1_RowDataBound">
                        <Columns>
                            <asp:BoundField DataField="ProgramName" HeaderText="<%$ Resources:ProgramName %>"
                                SortExpression="ProgramName" />
                            <asp:TemplateField HeaderText="<%$ Resources:ReadOnly %>">
                                <itemtemplate>
                                <asp:CheckBox ID="cbxReadOnly" runat="server"  Enabled='<%# BooleanConverter(Eval("IsInherits")) %>' Checked='<%# BooleanConverter(Eval("ReadOnly")) %>' Visible ='<%# BooleanConverter(Eval("ChkVisible")) %>'
                                    OnCheckedChanged="cbxReadOnly_CheckedChanged" AutoPostBack="True" />
                            </itemtemplate>
                                <itemstyle horizontalalign="Center" />
                                <headerstyle horizontalalign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="<%$ Resources:LimitAccess %>">
                                <itemtemplate>
                                <asp:CheckBox ID="cbxLimitAccess" runat="server"  Enabled='<%# BooleanConverter(Eval("IsInherits")) %>' Checked='<%# BooleanConverter(Eval("LimitAccess")) %>' Visible ='<%# BooleanConverter(Eval("ChkVisible")) %>'
                                    OnCheckedChanged="cbxLimitAccess_CheckedChanged" AutoPostBack="True" />
                            </itemtemplate>
                                <itemstyle horizontalalign="Center" />
                                <headerstyle horizontalalign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="<%$ Resources:FullAccess %>">
                                <itemtemplate>
                                <asp:CheckBox ID="cbxFullAccess" runat="server" Enabled='<%# BooleanConverter(Eval("IsInherits")) %>'  Checked='<%# BooleanConverter(Eval("FullAccess")) %>'
                                    OnCheckedChanged="cbxFullAccess_CheckedChanged" AutoPostBack="True" />
                            </itemtemplate>
                                <itemstyle horizontalalign="Center" />
                                <headerstyle horizontalalign="Center" />
                            </asp:TemplateField>
                        </Columns>
                    </TServerControl:TGridView>
                    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="BLL_Delete"
                        InsertMethod="BLL_Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="BLL_Select"
                        TypeName="BLL_ManageRoleProgramMapping">
                        <DeleteParameters>
                            <asp:Parameter Name="original_RoleID" Type="Int32" />
                            <asp:Parameter Name="original_ProgramID" Type="Int32" />
                        </DeleteParameters>
                        <SelectParameters>
                            <asp:Parameter Name="RoleID" Type="Int32" />
                            <asp:Parameter Name="Parent" Type="Int32" />
                        </SelectParameters>
                        <InsertParameters>
                            <asp:Parameter Name="RoleID" Type="Int32" />
                            <asp:Parameter Name="ProgramID" Type="Int32" />
                        </InsertParameters>
                    </asp:ObjectDataSource>
                </td>
            </tr>
        </table>
        <div align="center">
            <%--        <asp:ImageButton ID="btnOK" ImageUrl="~/images/NewImages/but_06.jpg" runat="server" />
        <asp:ImageButton ID="btnCancel" ImageUrl="~/images/NewImages/but_20.jpg" runat="server" />--%>
            <asp:Button ID="btnOK" Visible="false" runat="server" Text="<%$ Resources:OK %>" />
            <asp:Button ID="btnCancel" runat="server" Text="<%$ Resources:Cancel %>" />
        </div>
    </asp:Panel>
</div>
<asp:Button ID="btnDummy" runat="server" SkinID="null" Style="display: none" />
<ajaxToolkit:ModalPopupExtender ID="mpSearch" runat="server" CancelControlID="btnCancel"
    PopupControlID="panel1" PopupDragHandleControlID="panel1" TargetControlID="btnDummy" />
